package com.shopping.Service.ServiceImpl;

import com.shopping.Entity.CommentInfo;
import com.shopping.Service.CommentInfoService;
import com.shopping.repository.CommentInfoRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class CommentInfoServiceImpl implements CommentInfoService {
    private final CommentInfoRepository commentInfoRepository;
    @Override
    public CommentInfo getCommentInfoByid(int id) {
        return  commentInfoRepository.findById(id);
    }

    @Override
    public boolean isComment(int id) {
        CommentInfo commentInfo = commentInfoRepository.findById(id);
        boolean b;
        if (null==commentInfo){
            b = false;
        }else {
            b = true;
        }
        return b;
    }

    @Override
    public CommentInfo save(CommentInfo commentInfo) {
        return commentInfoRepository.save(commentInfo);
    }

    @Override
    public boolean updateCommentInfo(CommentInfo commentInfo) {
        return false;
    }
}
